<template>
  <div class="detail">
    <van-nav-bar
      left-arrow
      left-text="返回首页"
      @click-left="goHomeHandel"
    ></van-nav-bar>
    <div class="history">
      <h1>
        {{ money + 1 }}<span>{{ "/" + day }}</span
        ><van-tag plain type="primary">广告</van-tag>
      </h1>
      <p>
        <span>历史日推<b>VIP</b></span
        ><van-icon name="arrow" /><img
          src="https://img1.baidu.com/it/u=2848178812,2645504148&fm=253&fmt=auto&app=138&f=JPEG?w=400&h=400"
          alt=""
        /><img
          src="https://img1.baidu.com/it/u=2848178812,2645504148&fm=253&fmt=auto&app=138&f=JPEG?w=400&h=400"
          alt=""
        /><img
          src="https://img1.baidu.com/it/u=2848178812,2645504148&fm=253&fmt=auto&app=138&f=JPEG?w=400&h=400"
          alt=""
        />
      </p>
      <div class="all">
        <h4>
          <van-icon name="play-circle-o" />播放全部<span
            ><van-icon name="bars" />多选</span
          >
        </h4>
        <div class="list-detail">
          <div
            class="list-detail-item"
            v-for="(item, index) in detail"
            :key="index"
          >
            <img :src="item.al.picUrl" alt="" @click="clickJump(item.id)" />
            <div class="tup">
              <h3>{{ item.name }}</h3>
              <p>
                <van-tag plain type="primary">SQ</van-tag>
                {{ item.ar[0].name }}
              </p>
            </div>
            <van-icon name="play-circle-o" />
            <van-icon name="ellipsis" />
          </div>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
import { DetailAPI } from "../services/Detail";
export default {
  data() {
    return {
      day: "",
      money: "",
      detail: [],
    };
  },
  async created() {
    const days = new Date();
    this.day = days.getDate();
    this.money = days.getMonth();
    const res = await DetailAPI();
    this.detail = res.data.dailySongs;
    // console.log(res.data.dailySongs);
  },
  methods: {
    clickJump(v) {
      this.$router.push({
        name: "Play",
        query: {
          id: v,
        },
      });
    },
    goHomeHandel() {
      this.$router.push({
        name: "Home",
      });
    },
  },
};
</script>

<style scoped lang="scss">
* {
  margin: 0;
  padding: 0;
  .detail {
    color: #fff;
    background-image: url(https://p1.music.126.net/iMYQNzWbR4oM1b85Y61jxg==/109951166679850771.jpg);
    overflow: auto;
    background-image: url(https://img0.baidu.com/it/u=2796648914,1473668849&fm=26&fmt=auto);
    overflow-x: hidden;
    h1 {
      background-color: rgba(255, 255, 255, 0);
    }
    .van-nav-bar {
      color: #fff;
      background-color: rgba(255, 255, 255, 0);
      position: fixed;
      .van-icon {
        color: white;
        margin: 5px;
      }
      .van-nav-bar__text {
        color: #fff;
        width: 80px;
        font-size: 18px;
      }
    }
    .history {
      width: 93%;
      margin: 0 auto;
      margin-top: 80px;
      h1 {
        margin-top: 10px;
        font-weight: normal;
        span {
          font-size: 18px;
          margin-left: 20px;
        }
        .van-tag--primary.van-tag--plain {
          margin-top: 15px;
          font-size: 12px;
          color: white;
          background-color: rgba(255, 255, 255, 0);
          float: right;
        }
        .van-tag--plain::before {
          bottom: 3px;
        }
      }
      p {
        display: block;
        width: 100%;
        height: 40px;
        margin-top: 10px;
        font-size: 13px;
        position: relative;
        span {
          float: left;
          padding: 3px 5px;
          text-indent: 12px;
          position: relative;
          width: 100px;
          background-color: #58585869;
          border-radius: 40px;
          b {
            position: absolute;
            font-size: 12px;
            top: 3px;
            left: 65px;
          }
        }
        .van-icon {
          float: right;
          font-size: 18px;
          top: 3px;
        }
        img {
          width: 20px;
          position: absolute;
          border-radius: 50%;
        }
        img:nth-of-type(1) {
          right: 30px;
        }
        img:nth-of-type(2) {
          right: 42px;
        }
        img:nth-of-type(3) {
          right: 55px;
        }
      }
    }
    .all {
      clear: both;
      width: 107.6%;
      margin: 0 -3.8%;
      background-color: #fff;
      border-top-left-radius: 20px;
      border-top-right-radius: 20px;
      h4 {
        display: block;
        padding: 20px;
        color: #000;
        font-weight: normal;
        .van-icon {
          color: #000;
        }
        .van-icon:nth-of-type(1) {
          font-size: 23px;
          top: 3px;
          margin-right: 10px;
        }
        span {
          float: right;
        }
      }
      .list-detail {
        color: #000;
        display: flex;
        flex-direction: column;
        margin-bottom: 3rem;
        .list-detail-item {
          width: 100%;
          margin: 10px 0;
          display: flex;
          justify-content: space-evenly;
          align-items: center;
          img {
            width: 80px;
          }
          .tup {
            width: 50%;
            h3 {
              width: 100%;
              overflow: hidden;
              white-space: nowrap;
              text-overflow: ellipsis;
            }
            p {
              color: #9b8181;
            }
          }
          .van-tag {
            width: 18px;
            text-indent: 0;
            color: red;
            font-size: 15px;
            background-color: #fff;
            border-radius: 0;
            margin-right: 10px;
          }
          .van-icon {
            font-size: 30px;
            color: #cecece;
          }
          .van-icon:nth-of-type(2) {
            transform: rotateZ(90deg);
          }
        }
      }
    }
  }
}
</style>
